﻿CREATE TABLE [dbo].[Roles] (
    [Id] [int] NOT NULL IDENTITY,
    [Name] [nvarchar](max) NOT NULL,
    CONSTRAINT [PK_dbo.Roles] PRIMARY KEY ([Id])
)
CREATE TABLE [dbo].[Users] (
    [Id] [int] NOT NULL IDENTITY,
    [Login] [nvarchar](max) NOT NULL,
    [Password] [nvarchar](max) NOT NULL,
    [Email] [nvarchar](max) NOT NULL,
    [EmployeeID] [int] NOT NULL,
    [EmployerID] [int] NOT NULL,
    CONSTRAINT [PK_dbo.Users] PRIMARY KEY ([Id])
)
CREATE UNIQUE INDEX [IX_Login] ON [dbo].[Users]([Login])
CREATE TABLE [dbo].[UserRoles] (
    [User_Id] [int] NOT NULL,
    [Roles_Id] [int] NOT NULL,
    CONSTRAINT [PK_dbo.UserRoles] PRIMARY KEY ([User_Id], [Roles_Id])
)
CREATE INDEX [IX_User_Id] ON [dbo].[UserRoles]([User_Id])
CREATE INDEX [IX_Roles_Id] ON [dbo].[UserRoles]([Roles_Id])
ALTER TABLE [dbo].[UserRoles] ADD CONSTRAINT [FK_dbo.UserRoles_dbo.Users_User_Id] FOREIGN KEY ([User_Id]) REFERENCES [dbo].[Users] ([Id]) ON DELETE CASCADE
ALTER TABLE [dbo].[UserRoles] ADD CONSTRAINT [FK_dbo.UserRoles_dbo.Roles_Roles_Id] FOREIGN KEY ([Roles_Id]) REFERENCES [dbo].[Roles] ([Id]) ON DELETE CASCADE
CREATE TABLE [dbo].[__MigrationHistory] (
    [MigrationId] [nvarchar](150) NOT NULL,
    [ContextKey] [nvarchar](300) NOT NULL,
    [Model] [varbinary](max) NOT NULL,
    [ProductVersion] [nvarchar](32) NOT NULL,
    CONSTRAINT [PK_dbo.__MigrationHistory] PRIMARY KEY ([MigrationId], [ContextKey])
)
INSERT [dbo].[__MigrationHistory]([MigrationId], [ContextKey], [Model], [ProductVersion])
VALUES (N'201501130839202_MyCoolMigration', N'DB_EntityFramework.Migrations.Configuration',  0x1F8B0800000000000400ED5ADD6EDB3614BE1FB0771074B50D6994A4379D61B7489D6430D6FC204E8BDD058C74EC08A52895A4521BC39E6C177BA4BDC20E25EA8F942C294DB3A1180A1436C9F39D5F1E9E739CBFFFFC6BFA661351E701B8086336730FF70F5C07981F07215BCFDC54AE5EBC72DFBCFEFEBBE969106D9C0FC5B997EA1C52323173EFA54C269E27FC7B8888D88F429FC7225EC97D3F8E3C12C4DED1C1C1CFDEE1A10708E12296E34CAF5326C308B22FF8751E331F1299127A1E0740855EC79D6586EA5C900844427C98B9276F6F4F91586ECF382E7E8EF9C7FDF702F83961648D42BBCE310D098AB504BA721DC2582C8944A127786A2979CCD6CB041708BDD92680E756840AD0CA4CAAE343F53A38527A79156101E5A742C6D148C0C397DA509E49FE2873BBA521D194B9D594D6993967EE754C41B88EC96932A75C9D6A357546B3E7D83B7B6570600CA97F7BCE3CA532E53063904A4EE89E7395DED1D0FF15B637F147603396525A971065C4BDC6022E5DF138012EB7D7B0D2722F02D7F19A749E495892D56872A5164CBE3C729D0B644EEE2894015033C052C61C7E01069C4808AE8894C099C2804C678BBBC14BFD5F70C388CB82F29C6CDE015BCBFB998B1F5DE72CDC4050AC6809DEB3102F1E12499E428B8406D70BF210AE33810DFEEA3AA05FAF8166BBE23E4CF2EB905D945BE5421480C791FA941FCF166F6F085F8344D163736719A7DC3744987A5544ED8C33053332CC14C9FF51B693D7BB18D3DD338499C1F68A08819E089E9FF3694442FA6FB04D68BC05589CF4F976100E1F8DD379CFF38B3CFE9A1797D9BEE645021872CD8F8588FD30635DBBE739DBA602A72C703A65C8BD59488D0EC5EB1C26788191E5CCFDC9B2461B5899B72A30FDB6ED449B7A351DEC0C86458924215ECF9A7A6A0D36B2259BE1AE4E6842079A29B7C25C826C38AF326D536E4BE926B1CEF016756E4283B8A664134187486DDF8A1F334DEE72652964299F3784BC705E8D3C97CB4CBE4D3D5A22B47458553E7A79FD58D4995E47A1393D274982F9A45678EA156799579DF317CBF11558946378BE6829C44A694B4EF81E903518BBC81A253D0BB9902744923BA232C43C88AC63F5F0EC889E82532D026D0F1521551C569F73829ECA5BC7AE81589912A9D611BE6D99A260B8BB852EABFE0925BCE5919DC7348D58D743BD8B3A2FCEEAF4F98A8D30F50CC14D5B7996B18C88350D3FC82DF9DD794ABF645961BC5BDAC9BE8E5774315307D04BC331AACAA40E53AD0E47D295461D462F8DC1A8CA862650B53E1A8D77A0F176B4AF1DC1CD8C6C87B17E60C645AA266A8BC6D644A11E959606A8F136D9961914C3194E5B202BC3944CC7C8A31FBB47CA93E93F5220F3DDB41D693D9FE691328CCA67D4782EA7FAE9EA1FDE586F597EC47550F6873050EFD8722B2444FBEAC0FEF2139DD31003B73A80B112AE40C8BCB973F1A97D658C7CFE3BE3174F88800E99C13C7B7B1A2A93F636A0233B9CFADC833D10EEDF13FE4344363FF6208D1B247C1BB66A74EF86B1ACDE62C102D8CCDCDF9D85C05EF6530A13E7063B0CE78F2FEEDEC7B8A9A723FF5228B3CBCECCFEC53D763FCAA8E87BF475ED7E4AECB35D69BE3F684B2E35E5BBA349D14C9CC56FB79A6CCFB9E4986127CEC12322AB127A1CEF826E04F3474C245A0B01A31DED1D461C5AA5C7253B010A129C633F7F63E644F82468695E91D52EDEBAED37041832C4503FA6C00AB8CA4384E21B2E24C757DC2AF5AE78C8FC3021B4AEB15D870C499E4A9F12CEDC39810498CA8A96764398EDA8B84A60C3B27DDA774E7976854B5B9D567399EDAE56577D530133DC89CF1A31BB6AE2270F99F6C1A03DA0E91FFDB54DEFF47A5E12CFDCE02E4607E75970F858B0732AD806DB3AA76B85ED92B9B6D7C5A05DF6DD53C972A8B86338D9D1DC5959DD1C69F48D251BAA1ABDE7F0A164BF8AC5E073978AEDFDA29D89AC69DAF3283962F26AB788780F6B7F0580694084EB0A42FD4D0003BF7103CB330BB68A8B546048541C31CA93739024C0EB79CC65B822BEC46D1F84C87E43FA40689A158F77102CD8652A9354A2CA10DDD1C6AF702AA1ECE29F8D979B324F2F93ECB799A75001C50C5105B8646FD39006A5DC672D15520784CA54BA8951BE94AA99596F4BA48B980D04D2E62B13EC0D60E58D60E2922DC9033C46368CBF77B026FEB6E8F4BB41FA1DD134FBF424246B4E22A1312A7AFC8A311C449BD7FF001990D4CE0C230000 , N'6.1.2-31219')

